package com.test.exception;

import java.io.PrintWriter;
import java.io.StringWriter;

public class StackTrace {

	public static void main(String[] args) {

		try {
			throw new Exception("Stack Trace to String.");
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			e.printStackTrace(pw);
			System.out.println(sw.toString());
		}

	}

}
